import { connect } from 'react-redux'
import { bindActionCreators } from 'redux'
import topicActions from '../../store/entities/topics/actions'
import TopicProfile from './TopicProfile'

const mapStateToProps = (state,ownProps) => {

  const {id} = ownProps.navigation.state.params
  const {
    entities: {topics},
  } = state

  return {
    topic:topics[id]
  }
}


const mapDispatchToProps = dispatch => (
  {
    actions: bindActionCreators(topicActions, dispatch)
  }
)

export default connect(mapStateToProps,mapDispatchToProps)(TopicProfile)
